import request from '@/utils/request'

// 查询contract列表
export function listContract(query) {
  return request({
    url: '/contract/contract/list',
    method: 'get',
    params: query
  })
}

// 查询contract详细
export function getContract(id) {
  return request({
    url: '/contract/contract/' + id,
    method: 'get'
  })
}

// 新增contract
export function addContract(data) {
  return request({
    url: '/contract/contract',
    method: 'post',
    data: data
  })
}

// 修改contract
export function updateContract(data) {
  return request({
    url: '/contract/contract',
    method: 'put',
    data: data
  })
}

// 删除contract
export function delContract(id) {
  return request({
    url: '/contract/contract/' + id,
    method: 'delete'
  })
}

// 查询合同附件信息
export function getContractFile(contractNo) {
  return request({
    url: '/contract/contract/searchContractFile/' + contractNo,
    method: 'get'
  })
}

// 下载合同附件
export function downloadContractFile(fileId) {
  return request({
    url: '/file/file/downloadContractFile/' + fileId,
    method: 'post',
    responseType: 'blob',
    headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
  })
}
